# -*- coding: utf-8 -*-
"""
Created on Thu Aug 19 16:56:31 2021

@author: xiong
"""
import arcpy

name = r'260_岗松灌丛'
workspace = r'E:\tutu\216_岗松灌丛__未压点完成_结果特别差_需要切图斑'
focus = r'E:\tutu\123\260_岗松灌丛_图斑.shp'


ddy ='''
A067
'''

a = ['A','B','C','D']
dic = {}
temprlist = ['温度交错带','高山极地带','苔原带','寒温带','中温带','暖温带','亚热带','热带']
for i in ddy.split('\n'):
    if i:
        
        dey = str(a.index(i[0]) + 1)
    
        for j in range(1,len(i)):
            path = workspace + '\\' + i[0] + '\\'+str(i[j]) +'_' + temprlist[int(i[j])]
            namee = '_'.join([name,temprlist[int(i[j])]])
            #namee = '_'.join([name,'大地域'+dey,temprlist[int(i[j])]])
            with arcpy.da.UpdateCursor( path +'\\数据\\%s图斑.shp'%namee,("Shape@XY",'大地域','地域','zlx')) as cursor:
                for row in cursor:
                    key = (round((row[0][0]),2),round((row[0][1]),2))
                    dic[key] = row[1:] 

with arcpy.da.UpdateCursor(name + '_图斑',("Shape@XY",'区域','小区域','类型')) as cursor:
    for row in cursor:
        key = (round((row[0][0]),2),round((row[0][1]),2))
        row[1] = dic[key][0]
        row[2] = dic[key][1]
        row[3] = dic[key][2]
        cursor.updateRow(row)